/**
 * @file data.c
 * @author YangSL (dalin@main.com)
 * @brief 对象字典回调函数实现文件
 * @version 0.0.1
 * @date 2022-09-28
 * 
 * @copyright Copyright (c) 2022
 * 
 */
#include "data.h"
#include "can_protocol.h"
#include "string.h"


ucom_data com_data;
int pdo_period = 0 ;

/* PDO数据buf */
uint8 mc_pdo_data[100];

/* 对象字典数据初始化 */
void can_obj_init(void)
{
	memset(&com_data,	0,sizeof(com_data));
	memset(mc_pdo_data,	0,sizeof(mc_pdo_data));	
}

/**************************************** SDO ****************************************/

uint8 test1_write_CanSlot(void * sender)
{
	test_data1 *temp = (test_data1*)sender;

	temp->test32 = htons(temp->test32 );

	return E_RET_SUCCESS;
}

uint8 test2_write_CanSlot(void * sender)
{
	test_data2 *temp = (test_data2*)sender;

	temp->data1 = htons(temp->data1 );
	temp->data2 = htons(temp->data2 );
	temp->data3 = htons(temp->data3 );
	temp->data4 = htons(temp->data4 );

	return E_RET_SUCCESS;
}

uint8 test3_write_CanSlot(void * sender)
{
	test_data3 *temp = NULL;


	return E_RET_SUCCESS;
}

uint8 test4_read_CanSlot(void * sender)
{
	test_data1 *temp = (test_data1 *)sender;
	temp->test8[0] = 0x01;
	temp->test8[1] = 0x02;
	temp->test8[2] = 0x03;
	temp->test8[3] = 0x04;

	return E_RET_SUCCESS;
}

uint8 test5_read_CanSlot(void * sender)
{
	test_data2 *temp = (test_data2 *)sender;

	temp->data1 = 0x11223344;
	temp->data2 = 0x11112222;
	temp->data3 = 0x12345678;
	temp->data4 = 0x12345678;

	return E_RET_SUCCESS;
}


uint8 test6_read_CanSlot(void * sender)
{
	test_data1 *temp = (test_data1 *)sender;


	return E_RET_SUCCESS;
}
uint8 test7_write_CanSlot(void * sender)
{
	test_data4 *temp = (test_data4 *)sender;


	return E_RET_SUCCESS;
}
/**************************************** PDO ****************************************/
/* PDO */
uint8 mc_pdo_write_01(void* sender)
{
	return E_RET_SUCCESS;
}

uint8 mc_pdo_write_02(void* sender)
{
	return E_RET_SUCCESS;
}

uint8 mc_pdo_write_03(void* sender)
{
	return E_RET_SUCCESS;
}

uint8 mc_pdo_write_04(void* sender)
{	
	sint16* data = (sint16*)sender;
	data = 0;

	return E_RET_SUCCESS ;
}

uint8 mc_pdo_write_05(void* sender)
{
	sint16* data = (sint16*)sender;
	data = 0;

	return E_RET_SUCCESS ;
}
uint8 mc_pdo_write_06(void* sender)
{
	sint16* data = (sint16*)sender;
	data = 0;

	return E_RET_SUCCESS ;
}
uint8 mc_pdo_write_07(void* sender)
{
    sint8* data = (sint8*)sender;
	data = 0;

	return E_RET_SUCCESS ;
}
uint8 mc_pdo_write_08(void* sender)
{
	sint16* data = (sint16*)sender;
	data = 0;

	return E_RET_SUCCESS ;
}
uint8 mc_pdo_write_09(void* sender)
{
	sint8* data = (sint8*)sender;
	data = 0;

	return E_RET_SUCCESS ;
}
uint8 mc_pdo_write_10(void* sender)
{
	return E_RET_SUCCESS;
}
